home *** CD-ROM | disk | FTP | other *** search
- property state, bucketFull, bucketChan, emptyBucket, dirtLoads, centerVertList, rightVertList, horizList, firstArrowChan, buttonData, patchChan, firstPatch, dirtChan, sandboxChan
- global gTruckObject, gSimObject, gLevelObject
-
- on birth me
- set state to 1
- set bucketFull to 0
- set dirtLoads to 0
- set patchChan to 4
- set bucketChan to 5
- set dirtChan to 6
- set firstArrowChan to 7
- set sandboxChan to 27
- set centerVertList to [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1, 1, 1, 1]
- set rightVertList to [1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1]
- set horizList to [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 1, 1, 1]
- set buttonData to [1: [0, 1, 1, 1], 2: [0, 1, 0, 0], 3: [1, 0, 0, 0], 4: [0, 0, 1, 1], 5: [1, 0, 0, 0]]
- return me
- end
-
- on setup me
- add(gActorList, birth(script "Rollover Anim Button Class", "goMenu( gDitchObject, me )", 27, 27, 5, "RCA-07VO01", "RCA-07RO01"))
- add(gActorList, birth(script "Rollover Anim Button Class", "help( gDitchObject, me )", 28, 28, 11, EMPTY, "RCA-05RO02"))
- puppetSprite(bucketChan, 1)
- puppetSprite(patchChan, 1)
- puppetSprite(dirtChan, 1)
- set the visible of sprite firstArrowChan to 0
- set emptyBucket to the castNum of sprite bucketChan
- set firstPatch to the castNum of sprite patchChan
- end
-
- on upButton me
- if state = 3 then
- buttonSound(me)
- repeat with delta in centerVertList
- moveVert(me, -1 * delta)
- end repeat
- set state to 1
- else
- if state = 5 then
- buttonSound(me)
- repeat with delta in rightVertList
- moveVert(me, -1 * delta)
- end repeat
- set state to 4
- end if
- end if
- updateButtons(me)
- end
-
- on downButton me
- if state = 1 then
- buttonSound(me)
- repeat with delta in centerVertList
- moveVert(me, delta)
- end repeat
- if bucketFull then
- depositDirt(me)
- end if
- set state to 3
- updateButtons(me)
- else
- if state = 4 then
- buttonSound(me)
- repeat with delta in rightVertList
- moveVert(me, delta)
- end repeat
- fillBucket(me)
- set state to 5
- go(the frame)
- updateButtons(me)
- end if
- end if
- end
-
- on depositDirt me
- set dirtLoads to dirtLoads + 1
- set the castNum of sprite patchChan to firstPatch + dirtLoads - 1
- set the locH of sprite patchChan to 320
- puppetSound("1030dump")
- emptyBucket(me)
- puppetTransition(51, 1)
- go(the frame)
- if dirtLoads = 3 then
- finishedGame(me)
- end if
- end
-
- on finishedGame me
- startTimer()
- repeat while the timer < 30
- end repeat
- puppetSound(0)
- puppetSound("1030cheer")
- set the castNum of sprite patchChan to firstPatch + dirtLoads
- puppetTransition(51, 1)
- go(the frame)
- set state to 1
- set bucketFull to 0
- set dirtLoads to 0
- repeat with button = 1 to 4
- set the visible of sprite (firstArrowChan + button - 1) to 1
- end repeat
- set the tileNum of the blockedCellObj of gTruckObject to 0
- set the tileType of the blockedCellObj of gTruckObject to #BG
- set x to blockCrossings(the cell of gTruckObject, getLast(the recordedMoveList of gSimObject))
- finishSound(me)
- clearAllActors()
- puppetSprite(bucketChan, 0)
- puppetSprite(patchChan, 0)
- puppetSprite(dirtChan, 0)
- keepSandboxBut(sandboxChan)
- puppetPalette("DitchPal")
- go("Grass")
- go(the frame + 1)
- puppetSprite(48, 0)
- puppetPalette("SimPal", 60)
- updateStage()
- puppetPalette(0)
- predrawSimButtons(gSimObject)
- go(label("Simulator" & string(the level of gLevelObject)))
- abort()
- end
-
- on fillBucket me
- set bucketFull to 1
- set the castNum of sprite bucketChan to emptyBucket + 1
- if dirtLoads = 2 then
- set the locH of sprite dirtChan to 1000
- end if
- puppetTransition(51, 1)
- end
-
- on emptyBucket me
- set bucketFull to 0
- set the castNum of sprite bucketChan to emptyBucket
- end
-
- on rightButton me
- if state = 2 then
- buttonSound(me)
- repeat with delta in horizList
- moveHoriz(me, delta)
- end repeat
- set state to 1
- else
- if state = 1 then
- buttonSound(me)
- repeat with delta in horizList
- moveHoriz(me, delta)
- end repeat
- set state to 4
- end if
- end if
- updateButtons(me)
- end
-
- on leftButton me
- if state = 1 then
- buttonSound(me)
- repeat with delta in horizList
- moveHoriz(me, -1 * delta)
- end repeat
- set state to 2
- else
- if state = 4 then
- buttonSound(me)
- repeat with delta in horizList
- moveHoriz(me, -1 * delta)
- end repeat
- set state to 1
- end if
- end if
- updateButtons(me)
- end
-
- on buttonSound me
- puppetSound("arrowClick")
- updateStage()
- finishSound(me)
- puppetSound("1030machine")
- end
-
- on moveVert me, delta
- startTimer()
- set the locV of sprite bucketChan to the locV of sprite bucketChan + delta
- moveSprites(me)
- end
-
- on moveHoriz me, delta
- startTimer()
- set the locH of sprite bucketChan to the locH of sprite bucketChan + delta
- moveSprites(me)
- end
-
- on finishSound me
- repeat while soundBusy(1)
- end repeat
- puppetSound(0)
- end
-
- on updateButtons me
- set buttonList to getProp(buttonData, state)
- repeat with button = 1 to count(buttonList)
- set boolean to getAt(buttonList, button)
- set the visible of sprite (firstArrowChan + button - 1) to boolean
- end repeat
- finishSound(me)
- end
-
- on moveSprites me
- repeat while the timer < 2
- end repeat
- updateStage()
- end
-
- on goMenu me, buttonObject
- forgetObstacle(gSimObject)
- set state to 1
- set bucketFull to 0
- set dirtLoads to 0
- clearAllActors()
- unpuppetAll()
- makeButtonJump(buttonObject)
- puppetSprite(48, 0)
- puppetPalette("DitchPal")
- go("Grass")
- go(the frame + 1)
- repeat with button = 1 to 4
- set the visible of sprite (firstArrowChan + button - 1) to 1
- end repeat
- unLoadCast()
- goLocationMap()
- end
-
- on help me, buttonObject
- birth(script "Help Parent", buttonObject, #Ditch)
- end
-